package top.zackyoung.erupt.proxy;

import top.zackyoung.erupt.entity.Student;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.core.exception.EruptApiErrorTip;
import xyz.erupt.jpa.dao.EruptDao;
import xyz.erupt.jpa.dao.EruptJpaDao;

/**
 * 实体类的代理
 *
 * @author ZackYoung
 * @version 1.0
 * @date 2021/10/21
 */
public class StudentDataProxy implements DataProxy<Student> {
    private EruptDao eruptDao;
    private EruptJpaDao eruptJpaDao;

    @Override
    public void beforeAdd(Student student) {
        //后台字段校验
        if ("张三".equals(student.getStudentName())) {
            throw new EruptApiErrorTip("名称禁止为张三！");
        }
    }

    @Override
    public void afterAdd(Student student) {

    }

    @Override
    public void afterUpdate(Student student) {

    }

    @Override
    public void afterDelete(Student student) {
    }
}
